package com.wuyan.locationdog.viewmodel

import androidx.lifecycle.MutableLiveData
import com.arcsoft.commonbase.base.BaseViewModel
import com.arcsoft.commonbase.net.RetrofitManager
import com.asd.yigongdan.ui.main.login.LoginBean

class LoginViewModel : BaseViewModel() {


    val loginBean = MutableLiveData<LoginBean>()
    val yzmBean = MutableLiveData<Any>()
    val any = MutableLiveData<Any>()
    val success = MutableLiveData<Any>()

    fun getLogin(map: HashMap<String, Any>) {
        launch(block = {
            loginBean.value = RetrofitManager.apiService.getLogin(map).apiData()
        })
    }
    fun findPwd(map: HashMap<String, Any>) {
        launch(block = {
            loginBean.value = RetrofitManager.apiService.findPwd(map).apiData()
        })
    }
    fun deviceLogin(map: HashMap<String, Any>) {
        launch(block = {
            loginBean.value = RetrofitManager.apiService.deviceLogin(map).apiData()
        })
    }
    fun getCode(map: HashMap<String, Any>) {
        launch(block = {
            yzmBean.value = RetrofitManager.apiService.getCode(map).apiData()
        })
    }
    fun checkCode(map: HashMap<String, Any>) {
        launch(block = {
            any.value = RetrofitManager.apiService.checkCode(map).apiData()
        })
    }
    fun updatePhone(map: HashMap<String, Any>) {
        launch(block = {
            success.value = RetrofitManager.apiService.updatePhone(map).apiData()
        })
    }

    fun register(map: HashMap<String, Any>) {
        launch(block = {
            loginBean.value = RetrofitManager.apiService.register(map).apiData()
        })
    }
    fun bindPhone(map: HashMap<String, Any>) {
        launch(block = {
            any.value = RetrofitManager.apiService.bindPhone(map).apiData()
        })
    }
}